//package com.scwatch.ext.web.jpush;
//
//import com.scwatch.common.web.Servlets;
//import com.scwatch.core.constant.Constants;
//import com.scwatch.core.domain.Invite;
//import com.scwatch.core.service.InviteService;
//import com.scwatch.core.service.OperationLogService;
//import com.scwatch.core.support.Context;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.domain.Page;
//import org.springframework.data.domain.Pageable;
//import org.springframework.data.domain.Sort;
//import org.springframework.data.web.PageableDefault;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.ModelAttribute;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.servlet.mvc.support.RedirectAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.Map;
//
//import static com.scwatch.core.constant.Constants.*;
//
///**
// * @title :  后台 页面数据展示
// **/
//@Controller
//@RequestMapping("/ext/invite_code_dev")
//public class InviteCodeDevController {
//    private static final Logger logger = LoggerFactory
//            .getLogger(InviteCodeDevController.class);
//
//
//    @Autowired
//    private InviteService inviteService;
//
//    @Autowired
//    private OperationLogService logService;
//
//    @RequiresPermissions("ext:invite_code_dev:save")
//    @RequestMapping("save.do")
//    public String save(HttpServletRequest request, Invite bean, String redirect,
//                       RedirectAttributes ra) {
//        Integer siteId = Context.getCurrentSiteId();
//        Integer userId = Context.getCurrentUserId();
////        inviteService.saveOrUpdata(bean);
//        logService.operation("opr.Invite.add",
//                StringUtils.substring(bean.getInvitePeople(), 0, 150), null,
//                bean.getId(), request);
//        ra.addFlashAttribute(MESSAGE, SAVE_SUCCESS);
//        if (Constants.REDIRECT_LIST.equals(redirect)) {
//            return "redirect:list.do";
//        } else if (Constants.REDIRECT_CREATE.equals(redirect)) {
//            return "redirect:create.do";
//        } else {
//            ra.addAttribute("id", bean.getId());
//            return "redirect:edit.do";
//        }
//    }
//    @RequiresPermissions("core:invite_code_dev:update")
//    @RequestMapping("update.do")
//    public String update(@ModelAttribute("bean") Invite bean,
//                         Integer position, String redirect, HttpServletRequest request,
//                         RedirectAttributes ra) {
////        inviteService.saveOrUpdata(bean);
//        logger.info("update Comment, id={}.", bean.getId());
//        logService.operation("opr.Invite.edit",
//                StringUtils.substring(bean.getInvitePeople(), 0, 150), null,
//                bean.getId(), request);
//        ra.addFlashAttribute(MESSAGE, SAVE_SUCCESS);
//        if (Constants.REDIRECT_LIST.equals(redirect)) {
//            return "redirect:list.do";
//        } else {
//            ra.addAttribute("id", bean.getId());
//            return "redirect:edit.do";
//        }
//    }
//
//    @RequiresPermissions("core:invite_code_dev:delete")
//    @RequestMapping("delete.do")
//    public String delete(Integer[] ids, HttpServletRequest request,
//                         RedirectAttributes ra) {
//        Invite[] beans = inviteService.delete(ids);
//        for (Invite bean : beans) {
//            logService.operation("opr.Invite.delete",
//                    StringUtils.substring(bean.getInvitePeople(), 0, 150), null,
//                    bean.getId(), request);
//            logger.info("delete Invite, id={}.", bean.getId());
//        }
//        ra.addFlashAttribute(MESSAGE, DELETE_SUCCESS);
//        return "redirect:list.do";
//    }
//
//
//    @RequiresPermissions("core:invite_code_dev:create")
//    @RequestMapping("create.do")
//    public String create(Integer id, org.springframework.ui.Model modelMap) {
//        if (id != null) {
//            Invite bean = inviteService.findById(id);
//            modelMap.addAttribute("bean", bean);
//        }
//        modelMap.addAttribute(OPRT, CREATE);
//        return "ext/invite_code_dev/invite_form";
//    }
//
//
//    @RequiresPermissions("ext:invite_code_dev:list")
//    @RequestMapping("list.do")
//    public String list(
//            @PageableDefault(sort = "id", direction = Sort.Direction.DESC) Pageable pageable,
//            HttpServletRequest request, Invite invite,
//            org.springframework.ui.Model modelMap) {
//        Map<String, String[]> params = Servlets.getParamValuesMap(request,
//                Constants.SEARCH_PREFIX);
//        Page<Invite> pagedList = inviteService.findAll(params, pageable);
//        modelMap.addAttribute("pageInviteList", pagedList);
//        return "ext/livebroadcast/invite_list";
//    }
//
//    @RequiresPermissions("ext:invite_code_dev:edit")
//    @RequestMapping("edit.do")
//    public String edit(HttpServletRequest request, Integer id,
//                       org.springframework.ui.Model modelMap) {
//        Invite  invite = inviteService.findById(id);
//        modelMap.addAttribute("bean", invite);
//        modelMap.addAttribute(OPRT, EDIT);
//        return "ext/invite_code_dev/invite_form";
//    }
//
//
//}
